package com.secondhand.project.mapper;

import com.secondhand.project.domain.ChatGroup;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ChatGroupMapper {
    ChatGroup selectChatGroupById(Long id);

    List<ChatGroup> selectChatGroupList(ChatGroup chatGroup);

    int insertChatGroup(ChatGroup chatGroup);

    int updateChatGroup(ChatGroup chatGroup);

    int deleteChatGroupById(Long id);

    int deleteChatGroupByIds(Long[] ids);

    @Select("select * from chat_group where user_id = #{userId}")
    List<ChatGroup> selectByUserId(Long userId);

    @Select("select * from chat_group where chat_user_id = #{chatUserId} and user_id = #{userId}")
    ChatGroup selectByChatUserIdAndUserId(@Param("chatUserId") Long chatUserId, @Param("userId") Long userId);

}
